package com.superman.supermarket.client.composite.cart.invalid;

import java.util.Map;

import com.google.gwt.user.client.ui.HTML;
import com.superman.supermarket.client.composite.cart.sku.CartSkuModule;

/**
 * 失效商品模块
 * 
 * @author superman
 * @version 2018年8月22日下午2:22:36
 */
public class CartInvalidSkuModule extends CartSkuModule {

	/**
	 * 构造方法
	 * 
	 * @author superman
	 * @version 2018年8月22日 下午3:55:21
	 */
	public CartInvalidSkuModule() {
		skupropnameshtml.getElement().getStyle().setProperty("width", "auto");
		counteditpanel.removeFromParent();

		checkbtn.setEnable(false);
		checkbtn.getElement().getStyle().setOpacity(0);

		wrapperpanel.getElement().getStyle().setProperty("position", "relative");

		HTML invalidHTML = new HTML();
		invalidHTML.setText("失效");
		invalidHTML.getElement().getStyle().setProperty("background", "rgba(0,0,0,0.4)");
		invalidHTML.getElement().getStyle().setProperty("height", "0.4rem");
		invalidHTML.getElement().getStyle().setProperty("lineHeight", "0.4rem");
		invalidHTML.getElement().getStyle().setProperty("padding", "0rem 0.133333rem");
		invalidHTML.getElement().getStyle().setProperty("borderRadius", "0.4rem");
		invalidHTML.getElement().getStyle().setProperty("color", "#fff");
		invalidHTML.getElement().getStyle().setProperty("fontSize", "9px");
		invalidHTML.getElement().getStyle().setProperty("position", "absolute");
		invalidHTML.getElement().getStyle().setProperty("top", "50%");
		invalidHTML.getElement().getStyle().setProperty("left", "0.133333rem");
		invalidHTML.getElement().getStyle().setProperty("webkitTransform", "translate3d(0, -50%, 0)");
		wrapperpanel.add(invalidHTML);

	}

	@Override
	public void setData(Map<String, Object> map) {
		super.setData(map);
		int state = (int) Double.parseDouble(String.valueOf(map.get("STATE")));
		if (state == -1) {
			quotahtml.setVisible(true);
			quotahtml.setText("其他规格有货");
		}
	}

}
